package org.jage.student.missevo.solution.energy;

import java.util.Collection;

import org.jage.action.IActionContext;
import org.jage.action.IPerformActionStategy;
import org.jage.action.SingleAction;
import org.jage.address.IAgentAddress;
import org.jage.agent.AgentException;
import org.jage.agent.IAgent;
import org.jage.agent.ISimpleAggregate;
import org.jage.property.ClassPropertyContainer;
import org.jage.student.missevo.solution.agent.MissEvoSimpleAgent;

public class SaveEnergyAction extends ClassPropertyContainer implements IPerformActionStategy {

	public void perfom(IAgent target, IActionContext context) throws AgentException {
		if (target == null) throw new IllegalArgumentException("target cannot be null");
		if (context == null) throw new IllegalArgumentException("context cannot be null");
		
		ISaveEnergyActionContext saveEnergyActionContext = (ISaveEnergyActionContext) context;
		MissEvoSimpleAgent currentAgent = (MissEvoSimpleAgent) target;
		
		saveEnergyActionContext.setAgentKind(currentAgent.getKind());
		saveEnergyActionContext.setEnergy(currentAgent.getEnergy());
	}
	
	public void finish(IAgent target, IActionContext context) {
	    // TODO Auto-generated method stub
	}
	
	public Collection<IAgentAddress> init(ISimpleAggregate aggregate,
	    SingleAction action) throws AgentException {
	    // TODO Auto-generated method stub
	    return null;
	}
}
